from config.area_config import AREA_CONFIG
import cv2
from tool import randomText


class Method():

    def method1(self,img):
        return randomText(["negative", "positive"])
    def method2(self,img):
        return randomText(["negative", "positive"])



method =  Method()

def select(dict_key,img):
    # 根据部件名称选择相应的算法调用
    # method_name = AREA_CONFIG[dict_key]
    # return getattr(method,methodname)(img)

    # 测试阶段随机调用算法
    if dict_key.startswith("A"):
        return getattr(method,'method1')(img)
    else:
        return getattr(method,'method2')(img)


if __name__ == '__main__':
    img = cv2.imread('D:\Desktop\pythonProject\kafkaTest/1.jpg')
    methodname = 'method'+'1'
    print(getattr(method,methodname)(img))
